package com.oocl.euc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.oocl.euc.entity.User;
import com.oocl.euc.service.UserService;

@Controller
public class UserController {
	@Autowired
	private UserService us;
	
	@RequestMapping(value="users",method=RequestMethod.GET,produces="application/json;charset=utf-8")
	@ResponseBody
	public Page<User> getUsersWithPage(Integer limit, Integer page, String searchFilters, String sort){
		return us.findAll(limit, page, searchFilters, sort);
	}
	
	@RequestMapping(value="user",method=RequestMethod.POST)
	@ResponseBody
	public Integer addUser(User user){
		return us.addUser(user);
	}
}
